export function findNode(element, value) {
  const key = getKey(element);
  if (!key) return null;
  const node = value.document.getNode(key);
  return node || null;
}

export function getKey(element) {
  const closest = element.closest('[data-key]');
  if (!closest) return null;

  const key = closest.getAttribute('data-key');
  if (key) {
    return key;
  }
}
